package jmcnet.libcommun.communs.newjmcnetds
{
	import mx.messaging.Channel;
	import mx.messaging.ChannelSet;
	import mx.messaging.channels.AMFChannel;

	[Bindable]
	public class ChannelConfiguration
	{
		public function ChannelConfiguration() {
		}
		
		public static const MESSAGE_BROKER_DESTINATION:String="/messagebroker/amf";
		private var _id:String="myamf";
		private var _messageBrokerUri:String=MESSAGE_BROKER_DESTINATION;
		private var _serverUrl:String="http://localhost:8080";
		private var _channelSet:ChannelSet = null;

		public function get id():String	{	return _id;}
		public function set id(value:String):void{	_id = value;}

		public function get serverUrl():String{	return _serverUrl;}
		public function set serverUrl(value:String):void{	_serverUrl = value;}
		
		public function get messageBrokerUri():String {	return _messageBrokerUri;}
		public function set messageBrokerUri(value:String):void	{_messageBrokerUri = value;	}

		public function get channelSet():ChannelSet {
			if (_channelSet == null) {
				var channel:AMFChannel = new AMFChannel(_id, _serverUrl+_messageBrokerUri);
				_channelSet = new ChannelSet();
				_channelSet.addChannel(channel);
			}
			
			return _channelSet;
		}
	}
}